import {  Response } from 'express';
export class Http{

    constructor(){}
    static send(res:any,errcode:any,errmsg:any,data:any)
    {
        if(data == null){
            data = {};
        }
        data.errcode = errcode;
        data.errmsg = errmsg;
        var jsonstr = JSON.stringify(data);
        res.send(jsonstr);
    }
    /**
     * 返回json
     * 
     * @static
     * @param {Response} res 
     * @param {*} ret 
     * @memberof Http
     */
    static sendJson(res:Response,ret:any):void
    {
        var str = JSON.stringify(ret);
        res.send(str)
    }
}